(() => {
var exports = {};
exports.id = 888;
exports.ids = [888];
exports.modules = {

/***/ 844:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* reexport safe */ private_next_pages_app_tsx__WEBPACK_IMPORTED_MODULE_0__.Z)
/* harmony export */ });
/* harmony import */ var private_next_pages_app_tsx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(178);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([private_next_pages_app_tsx__WEBPACK_IMPORTED_MODULE_0__]);
private_next_pages_app_tsx__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];

        // Next.js Route Loader
        
        
    
__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ }),

/***/ 321:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "s": () => (/* binding */ ChainBet)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(893);
/* harmony import */ var wagmi__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(998);
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(982);
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(ethers__WEBPACK_IMPORTED_MODULE_2__);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([wagmi__WEBPACK_IMPORTED_MODULE_1__]);
wagmi__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];



const ChainBet = ()=>{
    const { isConnected  } = (0,wagmi__WEBPACK_IMPORTED_MODULE_1__.useAccount)();
    const publicClient = (0,wagmi__WEBPACK_IMPORTED_MODULE_1__.usePublicClient)();
    const { data: walletClient  } = (0,wagmi__WEBPACK_IMPORTED_MODULE_1__.useWalletClient)();
    const disableActions = !isConnected;
    // const getBalanceOf = async () => {
    //     const tokenAddress = "0xb3e87310b95e3244a1a7a49e283af72173247fc8"; 
    //     const address = "0x7dD3839ec4e493E0cBDFEb83045DD318026407c8";
    //     const { data: accessTokenBalance } = useContractRead({
    //         address: tokenAddress,
    //         abi: [
    //           {
    //             inputs: [{ internalType: "address", name: "owner", type: "address" }],
    //             name: "balanceOf",
    //             outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
    //             stateMutability: "view",
    //             type: "function",
    //           },
    //         ],
    //         functionName: "balanceOf",
    //         args: [address],
    //       });
    //     console.log(address,accessTokenBalance);
    // }
    const getChainID = async ()=>{
        try {
            const chainId = await walletClient?.getChainId();
            console.log("walletClient.getChainId()", chainId);
        } catch (e) {
            console.error(e);
        }
    };
    const signMessage = async ()=>{
        try {
            if (walletClient != null) {
                const anyGlobal = window;
                const message = anyGlobal._signMessage.message;
                const [account] = await walletClient?.getAddresses();
                // sign
                const sig = await walletClient?.signMessage({
                    message,
                    account
                });
                anyGlobal._signMessage.sig = sig;
                console.log("signature:", sig);
            // const isValid = await publicClient.verifyMessage({
            //     address: account,
            //     message,
            //     signature: sig
            // })
            // console.log('isValid?', isValid)
            }
        } catch (e) {
            console.error(e);
        }
    };
    const sendToken = async ()=>{
        try {
            if (walletClient != null) {
                const anyGlobal = window;
                const tokenAddress = anyGlobal._sendToken.tokenAddress;
                const toAddress = anyGlobal._sendToken.toAddress;
                const decimals = anyGlobal._sendToken.decimals;
                const amount = ethers__WEBPACK_IMPORTED_MODULE_2__.ethers.utils.parseUnits(anyGlobal._sendToken.amount, decimals);
                // const [account] = await walletClient.getAddresses()
                const [account] = [
                    anyGlobal._sendToken.formAddress
                ];
                /* @ts-ignore-next-line */ const hash = await walletClient.sendTransaction({
                    account,
                    to: tokenAddress,
                    value: 0n,
                    data: new ethers__WEBPACK_IMPORTED_MODULE_2__.ethers.utils.Interface(wagmi__WEBPACK_IMPORTED_MODULE_1__.erc20ABI).encodeFunctionData("transfer", [
                        toAddress,
                        amount.toHexString()
                    ])
                });
                anyGlobal._sendToken.hash = hash;
                console.log("transaction response", hash);
            }
        } catch (e) {
            console.error(e);
        }
    };
    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
        children: [
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
                onClick: ()=>getChainID(),
                children: "get ChainID"
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
                id: "signMessage",
                onClick: ()=>signMessage(),
                children: "Sign Message"
            }),
            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
                id: "sendToken",
                onClick: ()=>sendToken(),
                children: "sendToken"
            })
        ]
    });
};

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ }),

/***/ 33:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "W": () => (/* binding */ CustomConnect)
/* harmony export */ });
/* unused harmony export BasciConnect */
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(893);
/* harmony import */ var _rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(921);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_1__]);
_rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];


const CustomConnect = ()=>{
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_1__.ConnectButton.Custom, {
        children: ({ account , chain , openAccountModal , openChainModal , openConnectModal , authenticationStatus , mounted  })=>{
            // Note: If your app doesn't use authentication, you
            // can remove all 'authenticationStatus' checks
            const ready = mounted && authenticationStatus !== "loading";
            const connected = ready && account && chain && (!authenticationStatus || authenticationStatus === "authenticated");
            return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                ...!ready && {
                    "aria-hidden": true,
                    style: {
                        opacity: 0,
                        pointerEvents: "none",
                        userSelect: "none"
                    }
                },
                children: (()=>{
                    if (!connected) {
                        return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
                            id: "openConnectModal",
                            onClick: openConnectModal,
                            type: "button",
                            children: "Connect Wallet"
                        });
                    }
                    // if (chain.unsupported) {
                    //     return (
                    //         <button id='openChainModal' onClick={openChainModal} type="button">
                    //             Wrong network
                    //         </button>
                    //     );
                    // }
                    return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
                        id: "openAccountdiv",
                        style: {
                            display: "flex",
                            gap: 12
                        },
                        children: [
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
                                id: "openChainModal",
                                "data-testid": "rk-chain-button",
                                onClick: openChainModal,
                                style: {
                                    display: "flex",
                                    alignItems: "center"
                                },
                                type: "button",
                                children: chain.name
                            }),
                            chain.hasIcon && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                id: "chainicon",
                                style: {
                                    background: chain.iconBackground,
                                    borderRadius: 999,
                                    height: 24,
                                    marginRight: 4,
                                    overflow: "hidden",
                                    width: 24
                                },
                                children: chain.iconUrl && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("img", {
                                    alt: chain.name ?? "Chain icon",
                                    src: chain.iconUrl,
                                    style: {
                                        height: 24,
                                        width: 24
                                    }
                                })
                            }),
                            chain.name ?? chain.id,
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                id: "displayBalance",
                                children: account.displayBalance ? `${account.displayBalance}` : ""
                            }),
                            /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("button", {
                                id: "openAccountModal",
                                "data-testid": "rk-account-button",
                                onClick: openAccountModal,
                                type: "button",
                                children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
                                    id: "address",
                                    children: account.address
                                })
                            })
                        ]
                    });
                })()
            });
        }
    });
};
const BasciConnect = ()=>{
    return /*#__PURE__*/ _jsx(ConnectButton, {});
};

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ }),

/***/ 178:
/***/ ((module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(893);
/* harmony import */ var _styles_globals_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(764);
/* harmony import */ var _styles_globals_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_styles_globals_css__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _rainbow_me_rainbowkit_styles_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(204);
/* harmony import */ var _rainbow_me_rainbowkit_styles_css__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_rainbow_me_rainbowkit_styles_css__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(921);
/* harmony import */ var _rainbow_me_rainbowkit_wallets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(45);
/* harmony import */ var wagmi__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(998);
/* harmony import */ var wagmi_chains__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(697);
/* harmony import */ var wagmi_providers_public__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(577);
/* harmony import */ var _components_ConnectWallet__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(33);
/* harmony import */ var _components_ChainBet__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(321);
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(982);
/* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(ethers__WEBPACK_IMPORTED_MODULE_10__);
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_3__, _rainbow_me_rainbowkit_wallets__WEBPACK_IMPORTED_MODULE_4__, wagmi__WEBPACK_IMPORTED_MODULE_5__, wagmi_chains__WEBPACK_IMPORTED_MODULE_6__, wagmi_providers_public__WEBPACK_IMPORTED_MODULE_7__, _components_ConnectWallet__WEBPACK_IMPORTED_MODULE_8__, _components_ChainBet__WEBPACK_IMPORTED_MODULE_9__]);
([_rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_3__, _rainbow_me_rainbowkit_wallets__WEBPACK_IMPORTED_MODULE_4__, wagmi__WEBPACK_IMPORTED_MODULE_5__, wagmi_chains__WEBPACK_IMPORTED_MODULE_6__, wagmi_providers_public__WEBPACK_IMPORTED_MODULE_7__, _components_ConnectWallet__WEBPACK_IMPORTED_MODULE_8__, _components_ChainBet__WEBPACK_IMPORTED_MODULE_9__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);











try {
    const anyGlobal = window;
    if (anyGlobal._ethers == null) {
        anyGlobal._ethers = ethers__WEBPACK_IMPORTED_MODULE_10__.ethers;
    }
} catch (error) {}
const { chains , publicClient , webSocketPublicClient  } = (0,wagmi__WEBPACK_IMPORTED_MODULE_5__.configureChains)([
    wagmi_chains__WEBPACK_IMPORTED_MODULE_6__.mainnet,
    wagmi_chains__WEBPACK_IMPORTED_MODULE_6__.polygon,
    wagmi_chains__WEBPACK_IMPORTED_MODULE_6__.arbitrum,
    wagmi_chains__WEBPACK_IMPORTED_MODULE_6__.avalanche,
    wagmi_chains__WEBPACK_IMPORTED_MODULE_6__.optimism,
    wagmi_chains__WEBPACK_IMPORTED_MODULE_6__.zora,
    ...process.env.NEXT_PUBLIC_ENABLE_TESTNETS === "true" ? [
        wagmi_chains__WEBPACK_IMPORTED_MODULE_6__.arbitrum
    ] : []
], [
    (0,wagmi_providers_public__WEBPACK_IMPORTED_MODULE_7__.publicProvider)()
]);
const projectId = "6b26904f4577ae8d81de0f9a59c70fb1";
const { wallets  } = (0,_rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_3__.getDefaultWallets)({
    appName: "chainbet.games",
    projectId,
    chains
});
const demoAppInfo = {
    appName: "chainbet.games"
};
const connectors = (0,_rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_3__.connectorsForWallets)([
    ...wallets,
    {
        groupName: "Other",
        wallets: [
            (0,_rainbow_me_rainbowkit_wallets__WEBPACK_IMPORTED_MODULE_4__.argentWallet)({
                projectId,
                chains
            }),
            (0,_rainbow_me_rainbowkit_wallets__WEBPACK_IMPORTED_MODULE_4__.trustWallet)({
                projectId,
                chains
            }),
            (0,_rainbow_me_rainbowkit_wallets__WEBPACK_IMPORTED_MODULE_4__.ledgerWallet)({
                projectId,
                chains
            })
        ]
    }
]);
const wagmiConfig = (0,wagmi__WEBPACK_IMPORTED_MODULE_5__.createConfig)({
    autoConnect: true,
    connectors,
    publicClient,
    webSocketPublicClient
});
function MyApp({ Component , pageProps  }) {
    return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(wagmi__WEBPACK_IMPORTED_MODULE_5__.WagmiConfig, {
        config: wagmiConfig,
        children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_3__.RainbowKitProvider, {
            appInfo: demoAppInfo,
            chains: chains,
            children: [
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(Component, {
                    ...pageProps
                }),
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_ConnectWallet__WEBPACK_IMPORTED_MODULE_8__/* .CustomConnect */ .W, {}),
                /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_ChainBet__WEBPACK_IMPORTED_MODULE_9__/* .ChainBet */ .s, {})
            ]
        })
    });
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MyApp);

__webpack_async_result__();
} catch(e) { __webpack_async_result__(e); } });

/***/ }),

/***/ 204:
/***/ (() => {



/***/ }),

/***/ 764:
/***/ (() => {



/***/ }),

/***/ 982:
/***/ ((module) => {

"use strict";
module.exports = require("ethers");

/***/ }),

/***/ 689:
/***/ ((module) => {

"use strict";
module.exports = require("react");

/***/ }),

/***/ 921:
/***/ ((module) => {

"use strict";
module.exports = import("@rainbow-me/rainbowkit");;

/***/ }),

/***/ 45:
/***/ ((module) => {

"use strict";
module.exports = import("@rainbow-me/rainbowkit/wallets");;

/***/ }),

/***/ 998:
/***/ ((module) => {

"use strict";
module.exports = import("wagmi");;

/***/ }),

/***/ 697:
/***/ ((module) => {

"use strict";
module.exports = import("wagmi/chains");;

/***/ }),

/***/ 577:
/***/ ((module) => {

"use strict";
module.exports = import("wagmi/providers/public");;

/***/ })

};
;

// load runtime
var __webpack_require__ = require("../webpack-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = __webpack_require__.X(0, [893], () => (__webpack_exec__(844)));
module.exports = __webpack_exports__;

})();